<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .one{
            padding: 0;
            background-color: #f00;
            margin-bottom: 50px;
        }
        .two{
            padding: 0;
            background-color: #f0f;
            margin-top: 100px;
        }

        .three{
            padding: 0;
            background-color: #32f;
            margin-right: 50px;
        }
        .four{
            padding: 0;
            background-color: #292;
            margin-left: 50px;
        }
        /*
        垂直方向上的margin会触发高度坍塌
        即 上下两个元素的margin 只会以较大的值为准

        而水平方向上的margin则没有这种现象
        */
    </style>

</head>
<body>
<div class="one">
    AAAA
</div>
<div class="two">
    BBB
</div>

<span class="three">CCC</span>
<span class="four">DDD</span>
</body>
</html>